/***** Serendipity Booksellers -- BTREE.h header file *****/

#include "bookdata.h"
#include <list>

// This class defines the node that is used to construct the binary tree
class BNODE
{
	friend class BTREE;
private:
	list<BookData>::iterator iter;
	BNODE *left, *right;
public:
	BNODE(list<BookData>::iterator iter,
		BNODE *left = NULL,
		BNODE *right = NULL)
	{
		this->iter = iter;
		this->left = left;
		this->right = right;
	}
};

// This is the binary tree class
class BTREE
{
	BNODE *root;
public:
	BTREE( ){ root = NULL; }
	void inorder(){inorder(root);};
	void insert(list<BookData>::iterator iter)
	{
		root = insert(root, iter);
	}

private:
	void inorder(BNODE *tree);
	BNODE *insert(BNODE *tree, list<BookData>::iterator iter);
};